﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class NewsDisplay : System.Web.UI.Page
{
    int newsID;
    News currentNews = new News();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userName"] != null)
        {
            if(!IsPostBack)
            {
                ReadNews();
            }
        }
        else 
        {
            Response.Redirect("~/Login.aspx");
        }

    }
    protected void ReadNews()
    {
      newsID=Convert.ToInt32( HttpContext.Current.Request.QueryString["id"]);
      DataSet ds = currentNews.GetSingleNews(newsID);
      RepeaterNews.DataSource = ds;
      RepeaterNews.DataBind();
      
      
    }
}
